---
kind: Deployment
apiVersion: apps/v1beta2
metadata:
  labels:
    vhsc-app: ${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}
  name: ${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}
  namespace: prod
spec:
  minReadySeconds: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      vhsc-app: ${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}
  template:
    metadata:
      labels:
        vhsc-app: ${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/path: /prometheus
        prometheus.io/port: '8079'
    spec:
      containers:
      - name: ${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}
        image: harbor.viewsupplychain.com/vhsc/${vhGrpcBuilder_firstName}-${vhGrpcBuilder_sprojectName}:%SVC_VERSION%
        imagePullPolicy: IfNotPresent
        env:
          - name: SPRING_PROFILES_ACTIVE
            value: prod
          - name: JAVA_OPTS
            value: "-Xmn960m -Xmx1920m -XX:CompressedClassSpaceSize=64m -XX:ReservedCodeCacheSize=64m -XX:MaxMetaspaceSize=128m"
        resources:
          requests:
            memory: "3Gi"
            cpu: "250m"
          limits:
            memory: "3Gi"
            cpu: "2"
        volumeMounts:
          - name: svclog
            mountPath: /svc/logs
          - name: svc-config
            mountPath: /svc/config
        ports:
          - containerPort: 8080
            protocol: TCP
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8079
          initialDelaySeconds: 120
          periodSeconds: 10
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe: 
          httpGet:
            path: /healthz
            port: 8079
          periodSeconds: 10
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
      - name: jaeger-agent
        image: harbor.viewsupplychain.com/vhsc/jaeger-agent:1.0.0
        ports:
        - containerPort: 5775
          protocol: UDP
        - containerPort: 5778
        - containerPort: 6831
          protocol: UDP
        - containerPort: 6832
          protocol: UDP
        command:
        - "/go/bin/agent-linux"
        - "--collector.host-port=jaeger-collector.kube-system:14267"
      imagePullSecrets: 
        - name: regsecret
      volumes:
        - name: svclog
          hostPath:
            path: /home/svc/logs
        - name: svc-config
          secret: 
            secretName: vhsc-config
